package cc.vv.btpartyjob.partymanager.delegate

import android.widget.TextView
import cc.vv.baselibrary.view.BaseTopBarView
import cc.vv.btpartyjob.partymanager.R
import cc.vv.btpartyjob.partymanager.inter.CleanAddProjectItemClickInterface
import cc.vv.btpartyjob.partymanager.moudel.bean.AddProjectObj
import cc.vv.btpartyjob.partymanager.view.AddProjectView
import cc.vv.mvp.delegate.BaseAppDelegate

/**
 * 添加项目托管类
 * Created by Chen.qi on 2018/10/27.
 */
class AddProjectActivityDelegate : BaseAppDelegate() {

    override fun initWidget() {

    }

    override fun initLayoutRes(): Int {
        return R.layout.activity_add_project
    }

    /**设置标题title*/
    fun setTopBarTitle(topBarTitle: String) {
        val titleBar = getView<BaseTopBarView>(R.id.btv_addPr_topBar)
        titleBar?.setTitle(topBarTitle)
    }


    /**设置标题右边按钮点击事件*/
    fun setTitleBackBtnOnClick(event: BaseTopBarView.EventInterface) {
        val titleBar = getView<BaseTopBarView>(R.id.btv_addPr_topBar)
        titleBar?.setEventInterface(event)
    }

    fun setView(array: ArrayList<AddProjectObj>, cleanInter: CleanAddProjectItemClickInterface) {
        val apvView = getView<AddProjectView>(R.id.apv_addPr_addStage)
        apvView?.addAllSelectedFileView(array, cleanInter)
    }

    /**
     * 获取项目名称
     */
    fun getProjectName(): String {
        val projectName = getView<TextView>(R.id.et_addPr_projectName)
        return projectName?.text.toString().trim()
    }

    /**
     * 获取项目名称
     */
    fun getProjectContent(): String {
        val projectView = getView<TextView>(R.id.et_addPr_projectContent)
        return projectView?.text.toString().trim()
    }

    /**
     * 获取项目周期
     */
//    fun getProjectCycle(): String {
//        val projectView = getView<TextView>(R.id.et_addPr_projectCycle)
//        return projectView?.text.toString().trim()
//    }

    /**
     * 获取项目负责人姓名
     */
    fun getProjectPrincipalName(): String {
        val projectView = getView<TextView>(R.id.et_addPr_principalName)
        return projectView?.text.toString().trim()
    }

    /**
     * 获取项目负责人电话
     */
    fun getProjectPrincipalPhone(): String {
        val projectView = getView<TextView>(R.id.et_addPr_linkTelPhone)
        return projectView?.text.toString().trim()
    }

    /**
     * 设置项目类型
     */
    fun setProjectType(projectType: String?) {
        val projectView = getView<TextView>(R.id.tv_addPr_project)
        projectView?.text = projectType
    }

    /**
     * 设置申报时间类型
     */
    fun setShenBaoTime(sbTime: String?) {
        val projectView = getView<TextView>(R.id.tv_addPr_createData)
        projectView?.text = sbTime
    }

    /**
     * 设置申报时间类型
     */
    fun setStartTime(time: String?) {
        val projectView = getView<TextView>(R.id.tv_addPr_projectStartTime)
        projectView?.text = time
    }

    /**
     * 设置申报时间类型
     */
    fun setEndTime(time: String?) {
        val projectView = getView<TextView>(R.id.tv_addPr_proEndTime)
        projectView?.text = time
    }

    /**
     * 整体项目预警时间
     */
    fun setOverAllYJTime(yjTime: String?) {
        val projectView = getView<TextView>(R.id.tv_addPr_yuJinTime)
        projectView?.text = yjTime
    }

    /**
     * 整体项目完成时间
     */
    fun setOverAllCompleteTime(endTime: String?) {
        val projectView = getView<TextView>(R.id.tv_addPr_endTime)
        projectView?.text = endTime
    }

    /**
     * 整体项目状态选择
     */
    fun setOverAllStateSelect(state: String?) {
        val projectView = getView<TextView>(R.id.tv_addPr_status)
        projectView?.text = state
    }

    /**
     * 设置可见范围
     */
    fun setKeJian(str: String?) {
        val view = getView<TextView>(R.id.tv_addPr_kejian)
        view?.text = str
    }

}